<?php
namespace app\index\model;

use think\Model;

class CompanyModel extends model{

    protected $name = 'zhiniao_company';
    protected $pk = 'id';


    public function getOperateRangeAttr($operate_range){
        $keyword_list = ['成人高考', '成人教育', '函授', '成人', '教育'];
        $result = $operate_range;
        foreach ($keyword_list as $keyword) {
            $result = str_replace($keyword, '<span style="color:red;">'.$keyword.'</span>', $result);
        }  
        return $result;
    }


    public function getOtherPhoneAttr($other_phone){
        $result = [];
        $phone_arr = explode(';', $other_phone);
        foreach ($phone_arr as $item) {
            //正则匹配判断$item是不是11位手机号
            preg_match("/\d{11}/", $item, $match);
            if(isset($match[0])) $result[] = $match[0];
        }
        return $result;

    }

}